def median(pool):
    '''Statistical median to demonstrate doctest.
    >>> median([2, 9, 9, 7, 9, 2, 4, 5, 8])
    7
    >>> median([2, 9])
    5
    >>> median([9])
    9
    '''
    copy = sorted(pool)
    size = len(copy)
    if size % 2 == 1:
        return copy[(size-1)/2]
    else :
        return (copy[size/2-1] + copy[size/2])/2

   

#import doctest
from doctest import testmod
#doctest.testmod()
testmod()
